package org.grayrabbit.cms.content.imp;

import java.util.List;

import org.grayrabbit.cms.content.base.AbstractImportMission;
import org.grayrabbit.cms.content.base.BaseMission;
import org.grayrabbit.cms.content.base.CountDto;
import org.grayrabbit.cms.service.content.ContentService;


/**
 *		XMLImportMission.java
 *		@Author      hasau   
 *		@CreateTime  2012-2-10  上午11:13:45	
 **/
public class XMLImportMission  extends AbstractImportMission{
	private List<String> list; 
	private String key;
	private String siteId;
	private String categoryId;
	private ContentService contentService; 
	public XMLImportMission(List<String> list,String key,String siteId,
			String categoryId,ContentService contentService) {
		this.list = list;
		this.key = key;
		this.siteId = siteId;
		this.categoryId = categoryId;
		this.contentService = contentService;
	}
 
	@Override
	public void importContents() { 
		while(true){ 
			CountDto dto = (CountDto)(BaseMission.getMapItem(key));
			if(dto.getThreadCurrentNum()< BaseMission.THREAD_MAX_NUM){ 
				XMLImportThread  xmlImportThread = 
						new XMLImportThread(list,key,siteId,categoryId,contentService);
				Thread t= new Thread(xmlImportThread);
				t.start();					
				break;
			} 
		} 
	 		
	}
}
